<?php
/**
 * LogoutController.php
 *
 * @copyright  2023 beikeshop.com - All Rights Reserved
 * @link       https://beikeshop.com
 * @author     TL <mengwb@guangda.work>
 * @created    2023-04-23 20:22:54
 * @modified   2023-04-23 20:22:54
 */

namespace Beike\Seller\Http\Controllers;

use Beike\Seller\Models\SellerUser;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Auth;
use function redirect;

class LogoutController extends Controller
{
    /**
     * @param Request $request
     * @return \Illuminate\Contracts\Foundation\Application|\Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector
     */
    public function index(Request $request)
    {
        Auth::guard(SellerUser::AUTH_GUARD)->logout();

        $request->session()->regenerate();
        $request->session()->regenerateToken();

        return redirect(seller_route('login.index'));
    }
}
